<?php

namespace app\mp\admin;

use app\system\admin\Admin;

/**
 * 标签池
 * @author 飞燕
 *
 */
class MaterialTypeTags extends Admin
{
    protected $hisiModel = 'MaterialTypeTags';//模型名称[通用添加、修改专用]
    protected $hisiValidate = 'MaterialTypeTags';
    protected $hisiAddScene = '';//添加数据验证场景名
    protected $hisiEditScene = '';//更新数据验证场景名

    public function initialize() {
    	parent::initialize();
    }
    /**
     * 面料类型标签
     * @author 飞燕
     * @date 2020年9月29日
     */
    public function index()
    {
        if ($this->request->isAjax()) {
            $keyword    = $this->request->param('keyword/s');
            $where      = $data = [];
            if ($keyword) {
                $where[] = ['name', 'like', "%{$keyword}%"];
            }
            $page       = $this->request->param('page/d', 1);
            $limit      = $this->request->param('limit/d', 20);
            $order = 'id desc';
            $systemUserKV = getSystemUserKV(null);
            $data['data'] = db('material_type_tags')->where($where)->page($page)->limit($limit)->order($order)->select();
            $data['count'] = db('material_type_tags')->where($where)->count('id');
            $data['code'] = 0;
            $data['msg'] = '';
            return json($data);
    	}
    	$assign = [];
    	return $this->assign($assign)->fetch();
    }
}

